<?php 
    $val = $_POST['diem'];
   
    $idmon = $_POST['idmon'];
    $idhs = $_POST['idhs'];
    $key=$_POST['key'];
    $sql='';
    switch($key){
        case 'key_15ph':
            $sql="UPDATE hocsinh_monhoc SET diemtp_15ph='$val' WHERE id_hs='$idhs' AND id_mon='$idmon'";
            break;
        case '':
            $sql="UPDATE hocsinh_monhoc SET diemtp_1t='$val' WHERE id_hs='$idhs' AND id_mon='$idmon'";
            break;
        case '': 
            $sql="UPDATE hocsinh_monhoc SET diemtp_hk='$val' WHERE id_hs='$idhs' AND id_mon='$idmon'";
            break;
        case '':
            $sql="UPDATE hocsinh_monhoc SET diem_tbm='$val' WHERE id_hs='$idhs' AND id_mon='$idmon'";
            break;
    }
    $db->Execute($sql);
    echo $val;
    
?>